package com.hh.game.service.gateway.codec.websocket;

import com.hh.game.common.base.manager.session.Session;
import com.hh.game.service.gateway.codec.Response;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;

public class WebSocketResponse implements Response {
    private ChannelHandlerContext channelHandlerContext;
    private Object result;
    private String route;
    private Session session;
    private OutputMessage outputMessage;

    public WebSocketResponse(OutputMessage msg, Session session, ChannelHandlerContext channelHandlerContext) {
        this.outputMessage = msg;
        this.result = msg.getResult();
        this.session = session;
        this.channelHandlerContext = channelHandlerContext;
        this.route = msg.getRoute();
    }

    @Override
    public String getRoute() {
        return route;
    }

    @Override
    public Object getResult() {
        return result;
    }

    @Override
    public Session session() {
        return session;
    }

    @Override
    public Channel channel() {
        return channelHandlerContext.channel();
    }

    public OutputMessage getOutputMessage() {
        return outputMessage;
    }
}
